package br.siseventos.model;
// Generated 29/10/2012 23:23:36 by Hibernate Tools 3.2.1.GA

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * TdMencao generated by hbm2java
 */
@Entity
@Table(name = "td_mencao", catalog = "SisEventosDB", uniqueConstraints = {
    @UniqueConstraint(columnNames = "nme_mencao"),
    @UniqueConstraint(columnNames = "vlr_mencao")})
public class TdMencao extends BaseModel {

    private Integer idtMencao;
    private String nmeMencao;
    private int vlrMencao;
    private Set<TaAvaliacao> taAvaliacaos = new HashSet<TaAvaliacao>(0);

    public TdMencao() {
    }

    public TdMencao(String nmeMencao, int vlrMencao) {
        this.nmeMencao = nmeMencao;
        this.vlrMencao = vlrMencao;
    }

    public TdMencao(String nmeMencao, int vlrMencao, Set<TaAvaliacao> taAvaliacaos) {
        this.nmeMencao = nmeMencao;
        this.vlrMencao = vlrMencao;
        this.taAvaliacaos = taAvaliacaos;
    }

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "idt_mencao", unique = true, nullable = false)
    public Integer getIdtMencao() {
        return this.idtMencao;
    }

    public void setIdtMencao(Integer idtMencao) {
        this.idtMencao = idtMencao;
    }

    @Column(name = "nme_mencao", unique = true, nullable = false, length = 80)
    public String getNmeMencao() {
        return this.nmeMencao;
    }

    public void setNmeMencao(String nmeMencao) {
        this.nmeMencao = nmeMencao;
    }

    @Column(name = "vlr_mencao", unique = true, nullable = false)
    public int getVlrMencao() {
        return this.vlrMencao;
    }

    public void setVlrMencao(int vlrMencao) {
        this.vlrMencao = vlrMencao;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tdMencao")
    public Set<TaAvaliacao> getTaAvaliacaos() {
        return this.taAvaliacaos;
    }

    public void setTaAvaliacaos(Set<TaAvaliacao> taAvaliacaos) {
        this.taAvaliacaos = taAvaliacaos;
    }
    // Sobrescrevendo metodos utilitarios importantes   
    @Override
    public String toString() {
        return this.nmeMencao;
    }

    @Override
    public boolean equals(Object outro) {
        return (outro instanceof TdMencao) && (this.idtMencao != null)
                ? idtMencao.equals(((TdMencao) outro).getIdtMencao())
                : (outro == this);
    }

    @Override
    public int hashCode() {
        return (idtMencao != null)
                ? (this.getClass().hashCode() + idtMencao.hashCode())
                : super.hashCode();
    }
}
